﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MauTK_Mang1
{
    public class BubbleSort<T> : Sorting<T> where T : IComparable<T>
    {
        public override void sort(T[] t, IComparer<T> com)
        {
            for (int i = 0; i <= t.Length - 2; i++)
                for (int j = t.Length-1; j >= i+1 ; j--)
                    if (com.Compare(t[i],t[j]) >0)
                        swap(ref t[i], ref t[j]);
        }
        public override void sort(T[] t)
        {
            for (int i = 0; i <= t.Length - 2; i++)
                for (int j = t.Length - 1; j >= i + 1; j--)
                    if (t[i].CompareTo(t[j]) > 0)
                        swap(ref t[i], ref t[j]);
        }
    }
}
